package com.icss.ah.salesTopology.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 销售额拓扑服务类
 * @date 2017-8-8
 */
@Service
public class SalesTopologyService {
	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	private final Logger errlog = Logger.getLogger("E");
	private final Logger infolog = Logger.getLogger("I");
	
	/**
	 * 平台品类销售额查询
	 */
	public List<Map<String, Object>> queryCategorySales(Map<String, String> map){
		List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
		try {
			list = sqlSessionTemplate.selectList("SalesTopologyBean.queryCategorySales",map);
			infolog.info("SalesTopologyService|queryCategorySales|para:"+map);
		} catch (Exception e) {
			errlog.error("SalesTopologyService|queryCategorySales",e);
		}
		return list;
	}
	
	/**
	 * 品牌销售额查询
	 */
	public List<Map<String, Object>> queryBrandSales(Map<String, String> map){
		List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
		try {
			list = sqlSessionTemplate.selectList("SalesTopologyBean.queryBrandSales",map);
			infolog.info("SalesTopologyService|queryBrandSales|para:"+map);
		} catch (Exception e) {
			errlog.error("SalesTopologyService|queryBrandSales",e);
		}
		return list;
	}
	
	/**
	 * 商品销售额查询
	 */
	public List<Map<String, Object>> queryProductSales(Map<String, String> map){
		List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
		try {
			list = sqlSessionTemplate.selectList("SalesTopologyBean.queryProductSales",map);
			infolog.info("SalesTopologyService|queryProductSales|para:"+map);
		} catch (Exception e) {
			errlog.error("SalesTopologyService|queryProductSales",e);
		}
		return list;
	}

}
